/*
* 1videoConference -- An open source video conferencing platform.
*
* Copyright (C) 2007 - 2008, Adiance Technologies Pvt. Ltd.
*
* Hardik Sanghvi <hardik.sanghvi @adiance.com>
*
* See http://www.1videoconference.org for more information about
* the 1videoConference project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, forums and mailing lists
* for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/

using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using System.Reflection;
using System.IO;

namespace ZipInfo
{
    [ServiceContract(CallbackContract = typeof(IsvcZipInfoMain))]
    public interface IsvcZipInfoMain
    {
        [OperationContract(IsOneWay = true)]
        void svcJoin(string uName, string MeetingID);


        [OperationContract(IsOneWay = true)]
        void svcServiceStarted(string uName, string URI);

        [OperationContract(IsOneWay = true)]
        void svcUnJoin(string uName);

    }

    public class CsvcZipInfoMain: IsvcZipInfoMain
    {
        public delegate void delsvcJoin(string uName, string MeetingID);
        public delegate void delsvcServiceStarted(string uName, string URI);
        public delegate void delsvcUnJoin(string uName);

        public event delsvcJoin entsvcJoin;
        public event delsvcServiceStarted entsvcStarted;
        public event delsvcUnJoin entsvcUnJoin;


        public void svcJoin(string uName, string MeetingID)
        {
            if (uName != "Server")
            {
                entsvcJoin(uName, MeetingID);
            }
        }

        public void svcServiceStarted(string uName, string URI)
        { 
            entsvcStarted(uName, URI); 
        }

        public void svcUnJoin(string uName)
        {
            entsvcUnJoin(uName); 
        }
    }


    [ServiceContract(CallbackContract = typeof(IsvcZipInfoSub))]
    public interface IsvcZipInfoSub
    {
        [OperationContract(IsOneWay = true)]
        void svcJoin();

        [OperationContract(IsOneWay = true)]
        void svcZipFileInfo(string[] fileList);

        [OperationContract(IsOneWay = true)]
        void svcSetZipName(string zipfileName);

        [OperationContract(IsOneWay = true)]
        void svcSendZipFile(byte[] zipfile);

        [OperationContract(IsOneWay = true)]
        void svcSaveZipFile();

        [OperationContract(IsOneWay = true)]
        void svcUnjoin();

        [OperationContract(IsOneWay = true)]
        void svcServerFileList(string[] strServerFileInfo);

    }

    public class CsvcZipInfoSub : IsvcZipInfoSub
    {
        public delegate void DelsvcJoin();
        public delegate void DelsvcZipFileInfo(string[] fileList);
        public delegate void DelsvcSetZipName(string zipfileName);
        public delegate void DelsvcSendZipFile(byte[] zipfile);
        public delegate void DelsvcSaveZipFile();
        public delegate void DelsvcUnjoin();
        public delegate void DelsvcServerFileList(string[] strServerFileInfo);


        public event DelsvcJoin EntsvcJoin;
        public event DelsvcZipFileInfo EntsvcZipFileInfo;
        public event DelsvcSetZipName EntsvcSetZipName;
        public event DelsvcSendZipFile EntsvcSendZipFile;
        public event DelsvcSaveZipFile EntsvcSaveZipFile;
        public event DelsvcUnjoin EntsvcUnjoin;
        public event DelsvcServerFileList EntsvcServerFileList;

        public void svcJoin()
        {
            EntsvcJoin();
        }

        public void svcZipFileInfo(string[] fileList)
        {
            EntsvcZipFileInfo(fileList);
        }

        public void svcSetZipName(string zipfileName)
        {
            EntsvcSetZipName(zipfileName);
        }

        public void svcSendZipFile(byte[] zipfile)
        {
            EntsvcSendZipFile(zipfile);
        }

        public void svcSaveZipFile()
        {
            EntsvcSaveZipFile();
        }

        public void svcUnjoin()
        {
            EntsvcUnjoin();
        }

        public void svcServerFileList(string[] strServerFileInfo)
        {
            EntsvcServerFileList(strServerFileInfo);
        }

    }
}